<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- 展示数据 -->
        <table border="1" cellspacing="0" width="60%">
            <tr>
                <th>编号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th>成绩</th>
                <th>等级</th>
            </tr>

            <!-- 遍历数据 -->
            <tr style="text-align: center;" v-for="(user,index) in users" :key="index">
                <td>{{index + 1}}</td>
                <td>{{user.name}}</td>
                <td>{{user.age}}</td>
                <td>
                    <span v-if="user.gender === 1">男</span>
                    <span v-if="user.gender === 2">女</span>
                </td>
                <td>{{user.scope}}</td>
                <td>
                    <span v-if="user.scope >= 90">优秀</span>
                    <span v-else-if="user.scope >= 85">良好</span>
                    <span v-else-if="user.scope >= 60">及格</span>
                    <span v-else style="color: red;">不及格</span>
                </td>
            </tr>

        </table>

    </div>

</body>

</html>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                /* 准备数据 */
                users: [
                    { name: 'Tom', age: 20, gender: 1, scope: 78 },
                    { name: 'Rose', age: 18, gender: 2, scope: 85 },
                    { name: 'Jerry', age: 17, gender: 1, scope: 91 },
                    { name: 'Tony', age: 22, gender: 1, scope: 52 }
                ]
            }
        },
        methods: {
        }

    })
</script>